package org.example.mapper;


import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.pojo.Product;

import java.util.List;

@Mapper
public interface ProductMapper {

    // 查询商品
    @Select("select * from product")
    List<Product> findAll();

    // 根据id查询商品
    @Select("select * from product where id = #{id}")
    Product findById(Long id);

    // 根据id删除商品
    @Delete("delete from product where id = #{id}")
    void deleteById(Long id);
}
